#pragma once
#include "Game/Process/RenderProcess.h"
#include "Render/Tradition/ComputePipeline.h"
#include "Render/Shader/RHIDescriptor.h"
#include "Render/Tradition/RHIFramebuffer.h"
#include "LocalEntity.h"
#include "LocalMath.h"

class LocalScene;

class LightCullingProcess : public RenderProcess
{
	DECLARE_PROCESS(LightCullingProcess)

	struct PushConstants
	{
		glm::ivec2 viewportSize;
		glm::ivec2 tileNum;
		int32 lightNum;
	};

public:

	PushConstants mPushConstants;

	int32 mTileCountPerRow;

	int32 mTileCountPerCol;

protected:

	virtual void OnInit() override;

	virtual void OnTick(float deltaTime) override;

	virtual void OnResize() override;

protected:


	LocalScene* mLocalScene;

	LocalEntity* mSceneEntity;

	int32 mObjectSize;



	RefCountPtr<RHIBuffer> mTileLightVisiblities;




	RefCountPtr<RHIDescriptor> mDescriptor;

	DescriptorMask mDescriptorMask;



	RefCountPtr<ComputePipeline> mPipeline;

	RefCountPtr<RHICommandBuffer> mCommandBuffer;

	RefCountPtr<RHISemaphore> mWaitGraphicsSemaphore;

	RefCountPtr<RHISemaphore> mSignalComputeSemaphore;

};
